Signals are just signals, not rocket science! 📡
Here you will learn killing a process, sending it to the background, and bringing it back to the foreground.
Create a task using sleep:
sleep 100
sleep in Kali is used to pause the terminal for a specific time (100 seconds here).Ctrl + Z or open a split terminal/new tab.ps
# OR
ps aux | grep sleepsleep 100 command.kill PIDsleep 100 will be ended completely.kill PID failed, use:kill -9 PID-9 flag sends a force kill signal.jobs[1]).bg %11 with your job number. The % is mandatory).fg %1Remember:
bgandfgalways work in the same terminal where the process was initiated.- Some processes (like network scanners) continue counting time when suspended, while others (like text editors) do not.
Imagine a worker and a boss. The boss might stop him from working, or say to continue his work. SIGNAL is the message, while the processes are the workers.
View all signals with:
kill -l
Ctrl + Ckill PID.Difference between SIGINT and SIGTERM:
| Feature | SIGINT | SIGTERM |
|---|---|---|
| Signal Number | 2 | 15 |
| Shortcut | Ctrl + C |
None |
| Source | User (Keyboard) | System/Programs |
| Nature | Interrupt | Polite Stop |
Ctrl + Z. Pauses/suspends the process.Difference between SIGSTP and SIGSTOP:
| Feature | SIGSTP | SIGSTOP |
|---|---|---|
| Signal Number | 20 | 19 |
| Shortcut | Ctrl + Z |
None |
| Catchable | Yes | No |
| Signal | Code | Shortcut | Catchable? | Purpose |
|---|---|---|---|---|
| SIGINT | 2 | Ctrl + C |
Yes | Interrupt process (User). |
| SIGTERM | 15 | --- | Yes | Polite termination request. |
| SIGSTOP | 19 | --- | No | Strict suspension/freeze. |
| SIGSTP | 20 | Ctrl + Z |
Yes | Suspend/freeze (Terminal). |
| SIGCONT | 18 | --- | N/A | Resume a suspended process. |
| SIGKILL | 9 | --- | No | Forcefully kill a process. |
Catchable meaning: The program can intercept the signal (e.g., "Do you want to save your work?") before closing.
Format:
kill -SignalNumber PID
# OR
kill -SignalName PID
Example:
kill -9 1234
IMPORTANT:
If you startsleep 500, suspend it, and interpret it viaSIGCONTin a different way, it might resume in the background.